package br.com.sistema.web.componente;

import java.util.HashMap;
import java.util.Map;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

import br.com.framework.client.permissao.entidade.Tela;

public class TelaConverter implements Converter {

	private static Map<String, Tela> map = new HashMap<String, Tela>();

	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
		return map.get(arg2);
	}

	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		Tela tela = (Tela) arg2;
		map.put(tela.getId().toString(), tela);
		return tela.getId().toString();
	}

}
